
import {request} from '../utils/request'
import type {User,CodeType,UserInfo,Patient} from '../types/user'

//密码登录
export const loginByPassword=(mobile:string,password:string)=>{
   return request<User>('/login/password','post',{mobile,password})
}
//短信验证
export const sendMobileCode=(mobile:string,type:CodeType)=>{
  return request<{code:string}>('/code','get',{mobile,type})
}

//验证码登录
export const loginByCode=(mobile:string,code:string)=>{
  return request<User>('/login','post',{mobile,code})
}
//获取用户信息
export const getUserInfo=()=>{
  return request<UserInfo>('/patient/myUser')
}
//获取患者列表信息
export const getPatient=()=>{
  return request<Patient[]>('/patient/mylist')
}

// 添加患者信息
export const addPatient = (patient: Patient) => request('/patient/add', 'POST', patient)
// 编辑患者信息
export const editPatient = (patient: Patient) => request('/patient/update', 'PUT', patient)